package com.sds.sweng.swat.miplatform.ui.design.figures.logical;

import org.apache.commons.lang.StringUtils;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.jface.resource.ImageDescriptor;

import com.sds.sweng.swat.miplatform.ui.design.figures.MLabel;
import com.sds.sweng.swat.miplatform.ui.design.utils.FontUtils;

public class LCheckBoxFigure extends MLabel {

	private String text = StringUtils.EMPTY;

	public LCheckBoxFigure() {
		setBorder(new LineBorder(ColorConstants.lightGray, 1, Graphics.LINE_DASH));
		setFont(FontUtils.DEFAULT_FONT);
	}

	public void setText(String text) {
		this.text = text;
	}

	protected void paintFigure(Graphics graphics) {
		super.paintFigure(graphics);

		int x = bounds.x;
		int y = bounds.y;

		graphics.drawImage(ImageDescriptor.createFromFile(getClass(), "images/checkbox.gif").createImage(), x, y+(bounds.height/2)-6);
		graphics.drawText(text, x+18, y+4);
	}

}
